package com.iflytek.yousheng.tts;

import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;

/**
 * <pre>
 *服务
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.7.1)",
    comments = "Source: TTSEngine.proto")
public final class TTSEngineGrpc {

  private TTSEngineGrpc() {}

  public static final String SERVICE_NAME = "tts_engine.TTSEngine";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<AvatarTts.TTSRequest,
      AvatarTts.TTSResponse> METHOD_SPEECH =
      io.grpc.MethodDescriptor.<AvatarTts.TTSRequest, AvatarTts.TTSResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
          .setFullMethodName(generateFullMethodName(
              "tts_engine.TTSEngine", "Speech"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              AvatarTts.TTSRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              AvatarTts.TTSResponse.getDefaultInstance()))
          .setSchemaDescriptor(new TTSEngineMethodDescriptorSupplier("Speech"))
          .build();

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static TTSEngineStub newStub(io.grpc.Channel channel) {
    return new TTSEngineStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static TTSEngineBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new TTSEngineBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static TTSEngineFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new TTSEngineFutureStub(channel);
  }

  /**
   * <pre>
   *服务
   * </pre>
   */
  public static abstract class TTSEngineImplBase implements io.grpc.BindableService {

    /**
     */
    public io.grpc.stub.StreamObserver<AvatarTts.TTSRequest> speech(
        io.grpc.stub.StreamObserver<AvatarTts.TTSResponse> responseObserver) {
      return asyncUnimplementedStreamingCall(METHOD_SPEECH, responseObserver);
    }

    @Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            METHOD_SPEECH,
            asyncBidiStreamingCall(
              new MethodHandlers<
                AvatarTts.TTSRequest,
                AvatarTts.TTSResponse>(
                  this, METHODID_SPEECH)))
          .build();
    }
  }

  /**
   * <pre>
   *服务
   * </pre>
   */
  public static final class TTSEngineStub extends io.grpc.stub.AbstractStub<TTSEngineStub> {
    private TTSEngineStub(io.grpc.Channel channel) {
      super(channel);
    }

    private TTSEngineStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected TTSEngineStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new TTSEngineStub(channel, callOptions);
    }

    /**
     */
    public io.grpc.stub.StreamObserver<AvatarTts.TTSRequest> speech(
        io.grpc.stub.StreamObserver<AvatarTts.TTSResponse> responseObserver) {
      return asyncBidiStreamingCall(
          getChannel().newCall(METHOD_SPEECH, getCallOptions()), responseObserver);
    }
  }

  /**
   * <pre>
   *服务
   * </pre>
   */
  public static final class TTSEngineBlockingStub extends io.grpc.stub.AbstractStub<TTSEngineBlockingStub> {
    private TTSEngineBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private TTSEngineBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected TTSEngineBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new TTSEngineBlockingStub(channel, callOptions);
    }
  }

  /**
   * <pre>
   *服务
   * </pre>
   */
  public static final class TTSEngineFutureStub extends io.grpc.stub.AbstractStub<TTSEngineFutureStub> {
    private TTSEngineFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private TTSEngineFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected TTSEngineFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new TTSEngineFutureStub(channel, callOptions);
    }
  }

  private static final int METHODID_SPEECH = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final TTSEngineImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(TTSEngineImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @Override
    @SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }

    @Override
    @SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_SPEECH:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.speech(
              (io.grpc.stub.StreamObserver<AvatarTts.TTSResponse>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class TTSEngineBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    TTSEngineBaseDescriptorSupplier() {}

    @Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return AvatarTts.getDescriptor();
    }

    @Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("TTSEngine");
    }
  }

  private static final class TTSEngineFileDescriptorSupplier
      extends TTSEngineBaseDescriptorSupplier {
    TTSEngineFileDescriptorSupplier() {}
  }

  private static final class TTSEngineMethodDescriptorSupplier
      extends TTSEngineBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    TTSEngineMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (TTSEngineGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new TTSEngineFileDescriptorSupplier())
              .addMethod(METHOD_SPEECH)
              .build();
        }
      }
    }
    return result;
  }
}
